package com.zhangtao.demo.common.dto;

import io.netty.channel.Channel;

public class NChannelRes {

	private StringBuffer res;
	// true:正在接受数据， false:没有需要接受的数据(或以接受完数据)
	private Boolean receiveStatus;
	private String lastCommond;
	private Channel channel;

	public NChannelRes(Channel channel) {
		super();
		this.res = new StringBuffer();
		this.receiveStatus = false;
		this.channel = channel;
	}

	/**
	 * 
	 * @Title: startReceiveData
	 * @Description: 开始接受数据
	 * @param:
	 * @return: void
	 * @throws @author 张涛
	 * @Date 2018年11月19日 上午10:49:21
	 */
	public synchronized void startReceiveData() {
		this.receiveStatus = true;
		this.res = new StringBuffer();
	}

	/**
	 * 
	 * @Title: appendMsg
	 * @Description: 将接收的数据收集起来
	 * @param: @param msg
	 * @return: void
	 * @throws @author 张涛
	 * @Date 2018年11月19日 上午10:49:45
	 */
	public synchronized void appendMsg(String msg) {
		this.res.append(msg);
	}

	/**
	 * 
	 * @Title: getReceiveStatus
	 * @Description: 获取接收数据状态
	 * @param: @return
	 * @return: boolean
	 * @throws @author 张涛
	 * @Date 2018年11月19日 上午10:49:58
	 */
	public synchronized boolean getReceiveStatus() {
		return receiveStatus;
	}

	/**
	 * 
	 * @Title: setReceiveStatus
	 * @Description: 设置接收数据状态
	 * @param: @param receiveData
	 * @return: void
	 * @throws @author 张涛
	 * @Date 2018年11月19日 上午10:50:12
	 */
	public synchronized void setReceiveStatus(boolean receiveData) {
		this.receiveStatus = receiveData;
	}

	public StringBuffer getRes() {
		return res;
	}

	public Channel getChannel() {
		return channel;
	}

	public void setChannel(Channel channel) {
		this.channel = channel;
	}

	public String getLastCommond() {
		return lastCommond;
	}

	public void setLastCommond(String lastCommond) {
		this.lastCommond = lastCommond;
	}
}
